<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/common/common.jsp"%>
<%@ page import="com.chanyachting.emall.util.RequestUtil"%>
<%@ page import="com.chanyachting.emall.util.CodeMap"%>
<%@ page import="com.chanyachting.emall.domain.Applicationleter"%>
<%@ page import="com.chanyachting.emall.domain.Jobhistory"%>
<%@ page import="com.chanyachting.emall.service.ApplicationLeterService"%>
<%@ page import="com.chanyachting.emall.serviceImpl.ApplicationLeterServiceImpl"%>

<%@ page import="java.util.*"%>

<%

	RequestUtil ru=new RequestUtil(request);
	
	//获得求职信息id
	Integer appId=Integer.parseInt(ru.getParameter("id","0"));

%>


<script type="text/javascript">
<!--

	//显示工作经历输入表单
	function showAddJH(){

		//document.getElementById('showaddjh').style.display='';

		window.open("applicationLeter_jobhistory_add.jsp?id=<%=appId%>");

	}


	//删除工作经历
	function deleteJH(id){

		$.post(
				"<%=root %>/memberBackend/jobhistoryDel.do",
				{id:id,appId:"<%=appId%>"},
				function(data){

				$("#jobhistoryList").load("applicationLeter_jobhistory_list.jsp",{id:"<%=appId%>"});
		});
	}


	//修改工作经历
	function updateJH(id){


	}

//-->
</script>


<!-- 工作经历 -->
<table width="700" border="0" align="center" cellpadding="0"  cellspacing="0" >
	<tr>
		<td height="28" colspan="2" class="td_bottom">
			<strong>工作经历</strong>&nbsp;&nbsp;&nbsp;
			<input type="button" value="添加工作经历" onclick="showAddJH();"/>
		</td>
	</tr>
	
	<%
		
		List jhList=new ArrayList();
		
		if(appId>0){
			
			ApplicationLeterService alService=new ApplicationLeterServiceImpl();
			
			Applicationleter al=new Applicationleter();
			
			al.setId(appId);
			
			//通过编号获得求职信息对象
			al=alService.getOneApplicationLeter(al);
			
			jhList=new ArrayList(al.getJobhistorySet()); //将set转换为list
			
		}else{
			
			jhList=(List)ru.getSessionObject(ApplicationLeterService.JOBHISTORYLISTINSESSINO, new ArrayList());
		}

		//显示工作经历列表
	
		if(jhList!=null && jhList.size()>0){
			
			Jobhistory jh=null;
			
			for(int i=0;i<jhList.size();i++){
				
				jh=(Jobhistory)jhList.get(i);
				
				int id=i;
				
				if(appId>0) id=jh.getId();   //如果有求职信息编号，获得工作经历对应的数据库编号
				
	%>
	
	<tr>
		<td width="180" height="28">&nbsp;</td>
		<td width="520" align="right">
			<label> 
			 	<input type="button" value="删除" onclick="deleteJH('<%=id %>')"/>&nbsp;&nbsp;
			</label>
			
			<label> 
				<input type="button" value="编辑" onclick="updateJH('<%=id %>')"/>&nbsp;&nbsp;
			</label>
		</td>
	</tr>

	<tr>
		<td height="28" align="right">时间：</td>
		<td><%=jh.getBeginDate() %>  到   <%=jh.getEndDate() %> </td>
	</tr>
	<tr>
		<td height="28" align="right">单位名称：</td>
		<td><%=jh.getCompanyName() %></td>
	</tr>
	<tr>
		<td height="28" align="right">职位：</td>
		<td><%=jh.getPostName() %></td>
	</tr>
	<tr>
		<td height="28" align="right">月薪：</td>
		<td><%=jh.getMonthlyPay() %>元</td>
	</tr>
	<tr>
		<td height="28" align="right">离职主要原因：</td>
		<td><%=jh.getLeaveReason() %></td>
	</tr>
	<tr>
		<td height="28" align="right">工作描述：</td>
		<td><%=jh.getJobSummary() %></td>
	</tr>
	
	<tr>
		<td colspan="2" align="left" class="td_dashed"><label></label></td>
	</tr>
	
	<%
			}
		}
	%>
	
</table>

<!-- end 工作经历 -->



